const OpenAI = require("openai");
const { AIConfig } = require('../../config/AIconfig');
const { log } = require("console");
const openai = new OpenAI({
    baseURL: AIConfig.apiUrl,
    apiKey: AIConfig.apiKey,
});
exports.AIchat = async (req, res) => {
    const { message, model } = req.body;
    log(message, model);
    const completion = await openai.chat.completions.create({
        messages: [{ role: "system", content: `${JSON.stringify(message)}  use Chinese` }],
        model: model || "deepseek-v3-250324",
    });
    log(completion.choices[0].message.content);
    res.cc(completion.choices[0].message.content);
};